package com.hzdl.car.sqlprovider;

import com.hzdl.car.util.Common;
import com.hzdl.car.vo.RoleVo;
import org.apache.ibatis.jdbc.SQL;

public class RoleSqlProvider {
    public String findRole(RoleVo roleVo){
        return new SQL(){{
            SELECT("*");
            FROM("sys_role");
            if(!Common.isEmpty(roleVo.getRoleName())){
                WHERE("roleName like concat('%',#{roleName},'%')");
            }
            if(!Common.isEmpty(roleVo.getRoleDesc())){
                WHERE("roleDesc like concat('%',#{roleDesc},'%')");
            }
            if(roleVo.getAvailable()!=null){
                WHERE("available=#{available}");
            }
        }}.toString();
    }
}
